home *** CD-ROM | disk | FTP | other *** search
- Path: cix!slxsys!ukc!mcsun!uunet!tut.cis.ohio-state.edu!unreplyable!garbage
- From: dillon@overload.berkeley.ca.us (Matthew Dillon)
- Newsgroups: gnu.utils.bug
- Subject: BUG/COMPAT REPORT FOR DIFF-1.15.TAR
- Message-ID: <9102161054.AA03555@overload.Berkeley.CA.US>
- Date: 16 Feb 91 10:54:02 GMT
- Sender: daemon@tut.cis.ohio-state.edu
- Distribution: gnu
- Organization: GNUs Not Usenet
- Lines: 261
- Approved: bug-gnu-utils@prep.ai.mit.edu
-
-
- Hello, I have a bug / compatibility report for you. A few of the
- problems relate to a few unimplemented features in my C compiler,
- DICE, which you may or may not want to incorporate. However,
- there are some genuine bugs / problems too.
-
- diff.h needs to include regex.h, forgot exactly where the problem
- was, some structure that was referenced but not defined due to
- no regex.h being included for that source module.
-
- diff.h is also missing an EXTERN keyword on one of the structures,
- yielding multiple-defined symbols on my machine.
-
- The changes to DIR.C relate to my compiler not being able to handle
- structural returns yet (but I'm working on it! I just got dynamic
- stack extension working so at least I can run the GNU stack hogging
- programs now!)
-
- IO.C calculates a table index from a hash value via the mod operator
- without checking for possible negative results due to the signed
- int used for the hash value. This could be a bug in my compiler, I
- cannot remember whether mod is supposed to be able to return
- negative numbers or not. In anycase, it seemed dangerous.
-
- REGEX.C, a ?: construction has an expression return value of char *,
- but the second result is 0, which came back a warning on my compiler
- (again, this may be a non-bug since 0 == NULL by definition which is
- a valid pointer type)
-
- finally, I added #ifndef AMIGA's around the fork/wait code for
- the paginator. While I can write unix support routines for everything
- else, fork() is a major problem on the amiga (instead, we spawn
- independant processes. The amiga uses a linear address space).
-
- --
-
- In anycase, that's the bug report. Thanks for diff & patch !
-
- P.S. double check that the indenting hasn't been screwed up due to
- the retabbing.
-
- -Matt
-
- Matthew Dillon dillon@Overload.Berkeley.CA.US
- 891 Regal Rd. uunet.uu.net!overload!dillon
- Berkeley, Ca. 94708
- USA
-
- diff -c -w diff.old/diff.h diff/diff.h
- *** diff.old/diff.h Sun Jan 06 23:04:45 1991
- --- diff/diff.h Fri Feb 15 16:38:06 1991
- ***************
- *** 22,27 ****
- --- 22,28 ----
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- + #include "regex.h"
-
- #ifdef USG
- #include <time.h>
- ***************
- *** 318,324 ****
-
- /* Describe the two files currently being compared. */
-
- ! struct file_data files[2];
-
- /* Queue up one-line messages to be printed at the end,
- when -l is specified. Each message is recorded with a `struct msg'. */
- --- 319,325 ----
-
- /* Describe the two files currently being compared. */
-
- ! EXTERN struct file_data files[2];
-
- /* Queue up one-line messages to be printed at the end,
- when -l is specified. Each message is recorded with a `struct msg'. */
- diff -c -w diff.old/dir.c diff/dir.c
- *** diff.old/dir.c Thu Nov 29 21:15:42 1990
- --- diff/dir.c Fri Feb 15 13:05:01 1991
- ***************
- *** 31,37 ****
- char **files; /* Sorted names of files in the dir */
- };
-
- ! static struct dirdata
- dir_sort (dirname, nonex)
- char *dirname;
- int nonex;
- --- 31,37 ----
- char **files; /* Sorted names of files in the dir */
- };
-
- ! static struct dirdata *
- dir_sort (dirname, nonex)
- char *dirname;
- int nonex;
- ***************
- *** 38,44 ****
- {
- register DIR *reading;
- register struct direct *next;
- ! struct dirdata dirdata;
-
- /* Address of block containing the files that are described. */
- char **files;
- --- 38,44 ----
- {
- register DIR *reading;
- register struct direct *next;
- ! static struct dirdata dirdata;
-
- /* Address of block containing the files that are described. */
- char **files;
- ***************
- *** 53,59 ****
- {
- dirdata.length = 0;
- dirdata.files = 0;
- ! return dirdata;
- }
-
- /* Open the directory and check for errors. */
- --- 53,59 ----
- {
- dirdata.length = 0;
- dirdata.files = 0;
- ! return &dirdata;
- }
-
- /* Open the directory and check for errors. */
- ***************
- *** 62,68 ****
- {
- perror_with_name (dirname);
- dirdata.length = -1;
- ! return dirdata;
- }
-
- /* Initialize the table of filenames. */
- --- 62,68 ----
- {
- perror_with_name (dirname);
- dirdata.length = -1;
- ! return &dirdata;
- }
-
- /* Initialize the table of filenames. */
- ***************
- *** 101,107 ****
- dirdata.files = files;
- dirdata.length = files_index;
-
- ! return dirdata;
- }
-
- /* Sort the files now in the table. */
- --- 101,107 ----
- dirdata.files = files;
- dirdata.length = files_index;
-
- ! return &dirdata;
- }
-
- /* Sort the files now in the table. */
- ***************
- *** 144,151 ****
- int v1;
-
- /* Get sorted contents of both dirs. */
- ! data1 = dir_sort (name1, nonex1);
- ! data2 = dir_sort (name2, nonex2);
- if (data1.length == -1 || data2.length == -1)
- {
- if (data1.length >= 0)
- --- 144,151 ----
- int v1;
-
- /* Get sorted contents of both dirs. */
- ! data1 = *dir_sort (name1, nonex1);
- ! data2 = *dir_sort (name2, nonex2);
- if (data1.length == -1 || data2.length == -1)
- {
- if (data1.length >= 0)
- diff -c -w diff.old/io.c diff/io.c
- *** diff.old/io.c Thu Nov 29 21:15:43 1990
- --- diff/io.c Sat Feb 16 02:33:26 1991
- ***************
- *** 549,555 ****
-
- /* Check through the appropriate bucket to see if there isn't already
- an equivalence class for this line. */
- ! bucket = current->linbuf[n].hash % nbuckets;
- b = buckets[bucket];
- while (b)
- {
- --- 549,555 ----
-
- /* Check through the appropriate bucket to see if there isn't already
- an equivalence class for this line. */
- ! bucket = (current->linbuf[n].hash & 0x7FFFFFFF) % nbuckets;
- b = buckets[bucket];
- while (b)
- {
- diff -c -w diff.old/regex.c diff/regex.c
- *** diff.old/regex.c Thu Nov 29 21:21:43 1990
- --- diff/regex.c Fri Feb 15 13:14:11 1991
- ***************
- *** 857,863 ****
- BUFPUSH (stackp[-1]);
- }
- stackp -= 2;
- ! fixup_jump = *stackp ? *stackp + bufp->buffer - 1 : 0;
- laststart = *--stackp + bufp->buffer;
- break;
-
- --- 857,863 ----
- BUFPUSH (stackp[-1]);
- }
- stackp -= 2;
- ! fixup_jump = *stackp ? *stackp + bufp->buffer - 1 : (char *)0;
- laststart = *--stackp + bufp->buffer;
- break;
-
- diff -c -w diff.old/util.c diff/util.c
- *** diff.old/util.c Sun Jan 06 23:14:14 1991
- --- diff/util.c Fri Feb 15 18:49:19 1991
- ***************
- *** 131,136 ****
- --- 131,137 ----
-
- if (paginate_flag)
- {
- + #ifndef AMIGA
- int pipes[2];
- int desc;
-
- ***************
- *** 162,167 ****
- --- 163,169 ----
- close (pipes[0]);
- outfile = fdopen (pipes[1], "w");
- }
- + #endif
- }
- else
- {
- ***************
- *** 187,194 ****
- --- 189,198 ----
- {
- if (outfile != stdout)
- {
- + #ifndef AMIGA
- fclose (outfile);
- wait (0);
- + #endif
- }
- }
-
-
- Stuart A. Malone writes:
-
- First, the lack of a newline in the diff does not correspond to a lack
- of a newline on line b, but rather on line c, which is deceptive.
-
- This is a bug in GNU DIFF 1.14. Here is a patch.
-
- *** old/io.c Tue Jul 31 14:49:55 1990
- --- new/io.c Tue Jul 31 14:49:20 1990
- ***************
- *** 270,276 ****
- ++p;
- }
-
- ! if (output_style == OUTPUT_RCS && current->missing_newline)
- --current->linbuf[current->buffered_lines - 1].length;
-
- i = 0;
- --- 270,278 ----
- ++p;
- }
-
- ! if (output_style == OUTPUT_RCS
- ! && current->missing_newline
- ! && current->suffix_begin == current->buffer + current->buffered_chars)
- --current->linbuf[current->buffered_lines - 1].length;
-
- i = 0;
-
-
- Malone also writes:
-
- Second, programs like RCS and ED expect such scripts to _always_ end in
- a newline, and execute the script incorrectly when they do not. When
- producing scripts for RCS or ED, GNU DIFF should always end its output
- with a newline.
-
- This is a bug in RCS and ED, not in DIFF. RCS 4.2 and traditional ED do not
- properly handle a file that ends in a character other than a newline. I think
- the next major release of RCS will work with such files. Perhaps GNU ED will
- work with them, too, although a minor enhancement to ED's command set is
- probably needed.
-
-
-